<?xml version="1.0" encoding="UTF-8"?>
<!--
To change this template, choose Tools | Templates
and open the template in the editor.
-->
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://xmlns.jcp.org/jsf/html"
      xmlns:p="http://primefaces.org/ui"
      xmlns:f="http://xmlns.jcp.org/jsf/core" >
    <h:head>
        <title>Message Overview</title>
    </h:head>
    <h:body>
        <h:form>
             <p:messages id="messages" globalOnly="true" />  
             <p:dataTable value="#{messageOverViewBean.messages}" var="message" id="table">
                  <f:facet name="header">  
                      Messages from #{messageOverViewBean.owner.userName}
                </f:facet>  
                <p:column>
                    <f:facet name="header">Title</f:facet>
                        #{message.title}
                </p:column>
                <p:column>
                    <f:facet name="header">Message</f:facet>
                        #{message.message}
                </p:column>
                <p:column>
                    <f:facet name="header">Likes</f:facet>
                        #{message.likesToString()}
                </p:column>
                 <p:column>
                    <f:facet name="header">Like</f:facet>
                    <p:commandButton value="Like" action="#{messageOverViewBean.likeMessage(message)}" update="table"/> 
                </p:column>
            </p:dataTable>
             <p:commandButton value="Back" action="#{messageOverViewBean.toTwittererOverView()}" immediate="true" /> 
        </h:form>
    </h:body> 
</html>
